package com.lei.factory.impl;

import com.lei.factory.ICacheAdapt;
import com.lei.matter.EGM;

import java.util.concurrent.TimeUnit;

/**
 * @author: leiGer
 * @Date: 2022/01/15
 * @Time: 17:02
 */
public class EGMCacheAdapter implements ICacheAdapt {
    private EGM egm = new EGM();
    @Override
    public String get(String key) {
        return egm.gain(key);
    }

    @Override
    public void set(String key, String val) {
        egm.set(key,val);
    }

    @Override
    public void set(String key, String val, long timeout, TimeUnit timeUnit) {
        egm.setEx(key,val,timeout,timeUnit);
    }

    @Override
    public void del(String key) {
        egm.delete(key);
    }
}
